#!/bin/bash
#2018年6月6日20:39:06
#auto install zabbix
#by author www.jfedu.net
#######################
yum install -y gcc gcc-c++ glibc wget tar make
wget -c https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz
tar -xzf zabbix-3.2.6.tar.gz
cd zabbix-3.2.6
./configure --prefix=/usr/local/zabbix/ --enable-agent
make
make install
\cp ../zabbix-3.2.6/misc/init.d/tru64/zabbix_agent /etc/init.d/
chmod o+x /etc/init.d/zabbix_agentd
useradd -s /sbin/nologin zabbix
ln -s /usr/local/zabbix/sbin/* /usr/local/sbin/
mkdir -p /data/backup/20180606/
cp /usr/local/zabbix/etc/zabbix_agentd.conf /data/backup/20180606/
cat>/usr/local/zabbix/etc/zabbix_agentd.conf<<EOF
LogFile=/tmp/zabbix_agentd.log
Server=192.168.0.111
ServerActive=192.168.0.111
Hostname = 192.168.0.112
EOF
echo "
LogFile=/tmp/zabbix_agentd.log
Server=192.168.0.111
ServerActive=192.168.0.111
Hostname = 192.168.0.112
">/usr/local/zabbix/etc/zabbix_agentd.conf
/etc/init.d/zabbix_agentd start
ps -ef|grep zabbix
netstat -tnlp|grep 10050
setenforce 0
systemctl stop firewalld.service
